using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using ChatLib;

namespace Chat
{
	/// <summary>
	/// Summary description for FormOfflineMessages.
	/// </summary>
	public class FormOfflineMessages : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.RichTextBox rtbOfflineMessages;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormOfflineMessages()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		public FormOfflineMessages(ArrayList offlineMessages)
		{
			InitializeComponent();

			for(int i = 0;i < offlineMessages.Count; i++)
			{
				LetterReceive letter= offlineMessages[i] as LetterReceive;
				string message = letter.Message;
				string person = letter.From;
				if(message=="BUZZ BHI KARO")
				{							
					message=@"<DING>";
					this.Focus();
				}			
				rtbOfflineMessages.SelectionFont=new System.Drawing.Font("Microsoft Sans Serif",8.25f,System.Drawing.FontStyle.Bold);
				rtbOfflineMessages.AppendText(person+" : ");
				rtbOfflineMessages.SelectionFont=new System.Drawing.Font("Microsoft Sans Serif",8.25f,System.Drawing.FontStyle.Regular);
				rtbOfflineMessages.AppendText(message+" \n");
			}			
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormOfflineMessages));
			this.rtbOfflineMessages = new System.Windows.Forms.RichTextBox();
			this.btnOK = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// rtbOfflineMessages
			// 
			this.rtbOfflineMessages.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.rtbOfflineMessages.Location = new System.Drawing.Point(8, 8);
			this.rtbOfflineMessages.Name = "rtbOfflineMessages";
			this.rtbOfflineMessages.ReadOnly = true;
			this.rtbOfflineMessages.Size = new System.Drawing.Size(440, 208);
			this.rtbOfflineMessages.TabIndex = 0;
			this.rtbOfflineMessages.Text = "";
			// 
			// btnOK
			// 
			this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btnOK.Location = new System.Drawing.Point(376, 224);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(72, 24);
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "&OK";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// FormOfflineMessages
			// 
			this.AcceptButton = this.btnOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(456, 254);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.rtbOfflineMessages);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "FormOfflineMessages";
			this.Text = "Offline Messages";
			this.ResumeLayout(false);

		}
		#endregion

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
	}
}
